const {merge} = require('webpack-merge')
const common = require('./webpack.common')

const devConfig = {
	mode: 'development',
	devServer: {
		// contentBase: './dist'
		port: 8080,
		host: '0.0.0.0',
		compress: true,
		hot: true,
		open: true
	},
	devtool: 'source-map'
};

module.exports = (env, argv) => {
	console.log('开发启动')
	console.log(env, argv)
	const config = merge(common(env, argv), devConfig)
	if (argv.hot) {
		// Cannot use 'contenthash' when hot reloading is enabled.
		config.output.filename = '[name].[hash].js';
	}

	return config;
};